<?php

class Core_Component_System_Model_Dms_Entity extends Soul_Model_Entity_Base {
	
	protected $tableName = '{t}system_dms_entity';
    
    public function createModelInstance(){
        return Soul_Loader::loadInstance($this->getClassName());
    }
    
    public function getDynamicProperties() {
        if(!$this->issetData('dynamic_properties')){
            $this->data['dynamic_properties'] = App::getModel('system/dms_property')
                                                    ->getQuery()
                                                    ->condition('entity_id', $this->getIdValue())
                                                    ->orderby('sort', 'asc')
                                                    ->fetchCollection();
        }
        return $this->data['dynamic_properties'];
    }

    protected function initializeProperties() {
        $this->createProperty('id', 'integer', TRUE, TRUE);
        $this->createProperty('class_name', 'string');
        $this->createProperty('component_id', 'integer');
    }
}